package org.jackysoft.struts2.portal;
import java.util.Collection;

import javax.annotation.Resource;

import org.apache.struts2.convention.annotation.Namespace;
import org.jackysoft.annotations.Logger;
import org.jackysoft.entity.nosql.NewsInfo;
import org.jackysoft.service.NewsInfoService;
import org.jackysoft.struts2.UtilsCRUDAction;
import org.jackysoft.util.OperationType;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;


@Controller
@Namespace("/newsinfo")
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
@Logger(label="新闻",logType=OperationType.User)
public class NewsInfoAction 
extends UtilsCRUDAction<NewsInfo> {
	/**
	 * 
	 */
	private static final long serialVersionUID = 6076075310000411396L;
	private NewsInfoService service;
	private NewsInfo bean;
	private String catalog;
	private Collection<NewsInfo> beans;
	
	
    public String addother() throws Exception{
		service.create(bean.getCatalog(),bean.getCreateDate(),upLoad,upLoadFileName);
		return "add";
		
	}
	

	public String show() throws Exception{
		bean = service.get(bean.getId());
		return "show";
		
	}	
	
	public void setBean(NewsInfo bean){
	     this.bean = bean;
	}
	public NewsInfo getBean(){
	     return this.bean;
	}
	public void setBeans(Collection<NewsInfo> beans){
	
	     this.beans = beans;
	}
	public Collection<NewsInfo> getBeans(){
	     return this.beans;
	}
	
	@Resource
	public void setService(NewsInfoService service) {
		this.service = service;
		this.setDataProvider(service);
	}	
	
	public NewsInfoService getService(){
	   return this.service;
	}
	public void setCatalog(String catalog) {
		this.catalog = catalog;
	}
	public String getCatalog() {
		return catalog;
	}
		
}